package com.blood.core.po;

import com.blood.core.util.token.RSA;
import lombok.Data;
import org.springframework.stereotype.Component;

import java.security.KeyPair;

/**
 * @author daoren.
 * @version 1.0
 * @date 2020/9/1 16:53
 * @description
 */
@Data
@Component
public class SysData {

    /**
     * 公钥
     */
    private String publicKey;
    /**
     * 私钥
     */
    private String privateKey;

    public SysData() {
        //生成密钥对，一般生成之后可以放到配置文件中
        KeyPair keyPair = RSA.getKeyPair();
        //公钥
        this.publicKey = RSA.getPublicKey(keyPair);
        //私钥
        this.privateKey = RSA.getPrivateKey(keyPair);
    }
}
